package com.iee.patterns.example.link;

import com.iee.patterns.example.link.filter.impl.HaveBreakfastFilter;
import com.iee.patterns.example.link.filter.StudyPrepareFilter;
import com.iee.patterns.example.link.filter.impl.WashFaceFilter;
import com.iee.patterns.example.link.filter.impl.WashHairFilter;

/**
 *@ClassName Demo
 *@Description TODO
 *@Author longxiaonan@163.com
 *@Date 2022/3/15 0015 17:07
 */
public class Demo {

    public static void main(String[] args) {
        PreparationList preparationList = new PreparationList();
        preparationList.setWashFace(true);
        preparationList.setWashHair(true);
        preparationList.setHaveBreakfast(true);

        Study study = new Study();

        StudyPrepareFilter washFaceFilter = new WashFaceFilter();
        StudyPrepareFilter washHairFilter = new WashHairFilter();
        StudyPrepareFilter haveBreakfastFilter = new HaveBreakfastFilter();

        FilterChain filterChain = new FilterChain(study);
        filterChain.addFilter(washFaceFilter);
        filterChain.addFilter(washHairFilter);
        filterChain.addFilter(haveBreakfastFilter);

        filterChain.doFilter(preparationList, filterChain);
    }

}
